<!-- START PAGE -->
            	<!-- start stats -->
                <div id="stats" style="padding:3px;">
                    <!-- use it up/down on <b> tag for different colors -->
                	<div class="column"><?php echo $str_date; ?>: <b><?php echo number_format($earn_today); ?> VND</b>	</div>
                	<div class="column">Hôm qua (<?php echo date('d-m-Y', strtotime('-1 day')) ?>):	<b><?php echo number_format($earn_yesterday); ?> VND</b>	</div>
                	<div class="column last">Tổng tháng <?php echo $month ?>:	<b><?php echo number_format($earn_this_month); ?> VND</b></div>
                </div>
                <!-- end stats -->            	
                <div class="phdr" id="support"><b>Thống kê</b></div>
                <!-- end page title -->
                	<!-- START CONTENT -->
                    <div class="content">
					<div class="simplebox grid740" style="z-index: 720;"> 
						<form action="" method="get" name="form2" id="form2">
						<div class="st-form-line" style="z-index: 520;">
							Chọn tháng:	<input type="text" name="month" style="width:40px;" class="datepicker-input hasDatepicker" id="month">
							<input type="text" name="year" style="width:100px;" class="datepicker-input hasDatepicker" id="year">
								
							<a class="icon-button tips" href="javascript:;" onClick="document.form2.submit()" original-title="Search">
								Xem
							</a>
							<div class="clear" style="z-index: 510;"></div> 
						</div>
						</form>
					</div>
                        <!-- START CHART -->
                        <div class="simplebox grid740">
                        
                        	<div class="titleh"><h3>Biểu đồ doanh thu tháng <?php echo $m = $_GET['month'] != '' ? $_GET['month']."-".$_GET['year'] : date('m-Y');?></h3>
                            </div>
                            
                            <div class="body">
                                <!-- start chart -->
        						<div class="chart">
                                <table id="data">
                                	<tfoot>
                                    	<tr>
                                        	<th>1</th>
                                            <th>2</th>
                                            <th>3</th>
                                            <th>4</th>
                                            <th>5</th>
                                            <th>6</th>
                                            <th>7</th>
                                            <th>8</th>
                                            <th>9</th>
                                            <th>10</th>
                                            <th>11</th>
                                            <th>12</th>
                                            <th>13</th>
                                            <th>14</th>
                                            <th>15</th>
                                            <th>16</th>
                                            <th>17</th>
                                            <th>18</th>
                                            <th>19</th>
                                            <th>19</th>
                                            <th>20</th>
                                            <th>22</th>
                                            <th>23</th>
                                            <th>24</th>
                                            <th>25</th>
                                            <th>26</th>
                                            <th>27</th>
                                            <th>28</th>
                                            <th>29</th>
                                            <th>30</th>
                                            <th>31</th>
                                    	</tr>
                                	</tfoot>
                                    
                                    <tbody>
                                    	<tr>
                                        	<tr>
                                        	<?php for($i = 1; $i <= 31; $i++): ?>
											<td>
											<?php
											$m = '-'.$month;// != '' ? '-'.$month : date('-m-Y');
											$tmpDate = str_pad($i, 2, "0", STR_PAD_LEFT).$m;
											if(!empty($month_data)){
												if(array_key_exists($tmpDate, $month_data)){
													echo $month_data[$tmpDate];
												}
												else{
													echo '0';
												}
											}
											else{
												echo '01';
											}
											?>
											</td>
											<?php endfor; ?>
                                    	</tr>
                                    	</tr>
                                    </tbody>
                                </table>
                                <div id="holder"></div>
                                </div
                                <!-- end chart -->
                            </div
                        </div>
                        <!-- END CHART -->
                        <div class="clear"></div>
						<div class="titleh"><h3>Biểu đồ doanh thu theo ngày</h3></div>
						<table class="tablesorter" id="myTable"> 
							<thead> 
								<tr> 
									<th class="header">Ngày</th>
									<th class="header">SMS Java</th>
									<th class="header">Tiền Java</th> 								
									<th class="header">SMS Android</th>
									<th class="header">Tiền Android</th>
									<th class="header">SMS IOS</th>
									<th class="header">Tiền IOS</th>
									<th class="header">Tổng Doanh Thu</th>
								</tr> 
							</thead> 
							
							<tbody> 
								<?php
								if(!empty($items2)){
									foreach($items2 as $user2){
								?>
								<tr> 
									<td><?php echo $user2['earn_date'] ?></td>
									<td><?php echo $user2['java_SMS'] ?></td> 
									<td><?php echo $user2['java_earm'] ?></td> 
									<td><?php echo $user2['apk_sms'] ?></td> 
									<td><?php echo $user2['apk_earm'] ?></td> 
									<td><?php echo $user2['ios_sms'] ?></td> 
									<td><?php echo $user2['ios_earm'] ?></td> 
									<td><?php echo $user2['Total'] ?></td> 
								</tr> 
								<?php
									}
								}
								?>
								
							</tbody> 
						</table>
                        <div class="clear"></div>
						<div class="titleh"><h3>Biểu đồ doanh thu theo đầu số</h3></div>
						<table class="tablesorter" id="myTable"> 
							<thead> 
								<tr> 
									<th class="header">Đầu Số</th>
									<th class="header">SMS Java</th>					
									<th class="header">SMS Android</th>
									<th class="header">SMS IOS</th>
									<th class="header">Đơn Giá</th>
									<th class="header">Tổng Doanh Thu</th>
								</tr> 
							</thead> 
							
							<tbody> 
								<?php
								if(!empty($items3)){
									foreach($items3 as $user2){
								?>
								<tr> 
									<td><?php echo $user2['service_num'] ?></td>
									<td><?php echo $user2['java_SMS'] ?></td> 
									<td><?php echo $user2['apk_sms'] ?></td> 
									<td><?php echo $user2['ios_sms'] ?></td> 
									<td>
										<?php if ($user2['service_num'] == '8100') { echo '324';} ?>
										<?php if ($user2['service_num'] == '8200') { echo '648';} ?>
										<?php if ($user2['service_num'] == '8300') { echo '972';} ?>
										<?php if ($user2['service_num'] == '8400') { echo '1296';} ?>
										<?php if ($user2['service_num'] == '8500') { echo '1620';} ?>
										<?php if ($user2['service_num'] == '8600') { echo '3240';} ?>
										<?php if ($user2['service_num'] == '8700') { echo '4800';} ?>
									</td> 
									<td><?php echo $user2['Total'] ?></td> 
								</tr> 
								<?php
									}
								}
								?>
								
							</tbody> 
						</table>
                        <div class="clear"></div>
                    </div>
                    <!-- END CONTENT -->